package chinaums.web.controller;

import java.util.ArrayList;
import java.util.List;

import chinaums.common.anno.Log;
import chinaums.common.anno.Token;
import chinaums.common.util.Result;
import chinaums.entity.User;
import chinaums.service.IUserService;

import com.baomidou.mybatisplus.plugins.Page;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService userService;

    @Log("用户登录")
    @RequestMapping(value = "/userList", method = {RequestMethod.POST,RequestMethod.GET})
    public String login(HttpServletRequest request,HttpServletResponse response) {
    	List<User> list = new ArrayList<User>();
    	for(int i =1;i<5;i++){
    		User user = new User();
    		user.setUserId(i);
    		user.setUserName("test"+i);
    		user.setUserPassword("password"+i);
    		list.add(user);
    	}
    	request.setAttribute("userList", list);
    	return "userList";
    }

    @RequestMapping(value = "/addUser",  method = {RequestMethod.POST,RequestMethod.GET})
    @ResponseBody
    public String addUser(HttpServletRequest request,HttpServletResponse response) {
    	
    	
        return null;
    }
}
